import React, { Component } from 'react'
import { Route, Switch, Redirect } from 'react-router-dom'
import { asyncRoutes } from './routes'
import FrameLayout from './layout'

export default class App extends Component {
  render() {
    return (
      <FrameLayout>
        <Switch>
          {
            asyncRoutes.map(route => (
              <Route key={route.path} path={route.path} component={route.component} />
              ))
          }
          <Redirect from='/admin' to='/admin/dashboard' exact />
          <Redirect to='/404' />
        </Switch>
      </FrameLayout>
    )
  }
}
